package com.tf.mxj.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tf.mxj.entity.ActivitySignup;
import com.tf.mxj.mapper.ActivitySignupMapper;
import com.tf.mxj.service.ActivitySignupService;
import org.springframework.stereotype.Service;

/**
 * 活动报名服务实现类
 */
@Service
public class ActivitySignupServiceImpl extends ServiceImpl<ActivitySignupMapper, ActivitySignup> implements ActivitySignupService {

    @Override
    public boolean isUserSignedUp(Long activityId, Long userId) {
        QueryWrapper<ActivitySignup> query = new QueryWrapper<>();
        query.eq("activity_id", activityId).eq("user_id", userId);
        return this.count(query) > 0;
    }
}